<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
		<meta http-equiv="description" content="This is my page" />
		<link href="css/main.css" rel="stylesheet" type="text/css" />
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/seller.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<title>发布商品</title>
		<script type="text/javascript">
	    function select(){
          var id = document.getElementById("bigType").value
          $.ajax({  
          url: "sellerProductCenter!selectByBigType.do",   
          type: "post",  
          dataType: "json",
          data:'bigTypeId='+id,
          timeout: 1000,  
          error:function(){  
          document.write("<h1>Error</h1>");
          alert("Error loading XML document Or Data is Error"); 
          },  
          success:function(jsonContent){
          var tc = jsonContent.smallTypeList;
          showcheck(tc)
          } 
          });  
        }
       function showcheck(tc){
         $('#smallType').empty();
         var texts="<select name='smallTypeId'>";
         $.each(tc,function(i){
         texts+="<option value='"+tc[i].id+"'>"+tc[i].smallTypeName+"</option>"
         });
         texts+="</select>"
         $('#smallType').append(texts);
       }  
</script>
	</head>
	<body>
		<div align="center">
			<table border="0" cellpadding="0" cellspacing="0" width="910">
				<tbody>
					<tr>
						<td width="100% "></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div id="layout">
			<%@ include file="/WEB-INF/common/header/header.jsp"%>
			<div id="seller_main">
				<%@include
					file="/WEB-INF/jsp/seller/seller_common/seller_left_nav.jsp"%>

				<div id="seller_main_right">

					<div id="seller_right_top">
						当前位置：商品中心 &gt;&gt;
						<a href="sellerProductCenter!publishProduct.do">商品发布</a>
					</div>

					<div id="seller_product_title">
						&nbsp;&nbsp;商品操作
					</div>
					<div id="seller_public_product">
						<center>
							<form action="sellerProductCenter!publishProductOperator.do"
								method="post">
								<table width="489" border="0" cellspacing="0"
									class="seller_product">
									<s:if
										test="productTemp == null | productTemp.smallType == null">
										<tr>
											<td width="126" height="33">
												所属大类
											</td>
											<td width="359">
												<!-- ajax -->
												<s:select name="bigTypeId" list="bigTypeList" listKey="id"
													listValue="bigTypeName" headerKey="0" headerValue="--请选择--"
													id="bigType" onchange="select()" theme="simple" />
											</td>
										</tr>
										<tr>
											<td height="32">
												所属小类
											</td>
											<td>
												<div id="smallType">

													<s:select name="smallTypeId" list="smallTypeList"
														listKey="id" listValue="smallTypeName" headerKey="0"
														headerValue="--请选择--" theme="simple" />
												</div>
											</td>
										</tr>
									</s:if>
									<s:else>
										<tr>
											<td width="126" height="33">
												所属大类
											</td>
											<td width="359">
												<s:property value="productTemp.bigType_id" />
											</td>
										</tr>
										<tr>
											<td height="32">
												所属小类
											</td>
											<td>
												<s:property value="productTemp.smallType.smallTypeName" />
											</td>
										</tr>
									</s:else>
									<tr>
										<td height="31">
											商品名称
										</td>
										<td>
											<input type="text" size="20" name="currentProduct.name"
												value="<s:property value="productTemp.name" />" />
										</td>
									</tr>
									<tr>
										<td height="37">
											商品总数
										</td>
										<td>
											<input type="text" size="20"
												name="currentProduct.totalNumber"
												value="<s:property value="productTemp.totalNumber" />" />
											件
										</td>
									</tr>

									<tr>
										<td height="30">
											单件送积分
										</td>
										<td>
											<input type="text" size="20" name="currentProduct.score"
												value="<s:property value="productTemp.score" />" />
											分
										</td>
									</tr>
									<tr>
										<td height="32">
											市场价
										</td>
										<td>
											<input type="text" size="20"
												name="currentProduct.commonPrice"
												value="<s:property value="productTemp.commonPrice" />" />
											元
										</td>
									</tr>
									<tr>
										<td height="37">
											特惠价
										</td>
										<td>
											<input type="text" size="20"
												name="currentProduct.especialPrice"
												value="<s:property value="productTemp.especialPrice" />" />
											元
										</td>
									</tr>
									<tr>
										<td height="59">
											图片设置
										</td>
										<td>
											当前图片
											<p>
												<s:if test="productTemp == null | productTemp.photo1 == ''">
													<img src="images/default_product_pic.jpg" />
												</s:if>
												<!--  
											<s:if test="productTemp.photo1 == ''">
												<img src="images/default_product_pic.jpg" />
											</s:if>-->
												<s:else>
													<img src="<s:property value="productTemp.photo1"/>" />
												</s:else>
											</p>
										</td>
									</tr>
									<tr>
										<td height="47">

										</td>
										<td>
											<input type="text" size="20" name="currentProduct.photo1" />
											<a href="">选择图片</a>
										</td>
									</tr>
									<tr>
										<td height="80">
											商品说明
										</td>
										<td>
											<textarea rows="3" cols="20" name="currentProduct.title">
												<s:property value="productTemp.title" />
											</textarea>
										</td>
									</tr>
									<tr>
										<td height="82">
											商品描述
										</td>
										<td>
											<textarea rows="3" cols="20" name="currentProduct.info">
											<s:property value="productTemp.info" />
											</textarea>
										</td>
									</tr>
									<tr>
										<td height="33">
											&nbsp;

										</td>
										<td>
											<input type="submit" value="提交" />
										</td>
									</tr>
									<tr>
										<td height="33">
											&nbsp;

										</td>
										<td></td>
									</tr>
								</table>
							</form>
						</center>
					</div>

				</div>

			</div>
			<!--seller_main  end-->
			<%@include file="/WEB-INF/common/footer/footer.jsp"%>
		</div>
	</body>
</html>

